<style type="text/css">
    .remark{padding-top:4px;word-break:normal;width:auto;display:block; white-space:pre-wrap;word-wrap:break-word;overflow: hidden}
</style>
<link rel="stylesheet" type="text/css" href="../../../static/Huploadify-master/Huploadify.css">
<script type="text/javascript" src="../../../static/Huploadify-master/jquery.Huploadify.js"></script>
<style>
    li {
        list-style-type: none;
        vertical-align: middle;
        height: 30px;
        line-height: 30px;
        margin: 10px 0;
    }
    li a{text-decoration:none;}
    li a img{
        border:1px solid #999999;
        margin-right: 20px;
        float: left
    }
    li a div{
        float: left;
        width: 50%;
        text-align: center;
        height: 30px;
        line-height: 30px;
        vertical-align: middle;
        white-space:nowrap;
        overflow:hidden;
        text-overflow:ellipsis;
    }
    li a div{
        width:50%;
        text-align: center;
    }

</style>
<script type="text/javascript">

    //初始化页面
    var keyId = (getUrlParam("keyId", url));
    fy_api.load_template({controller: $("#saveForm").attr("templateParam", "keyId=" + keyId), initValue: true,loading: true,loaded: init});

    function init(){

        //设置状态
        var deleteFlag = $("#deleteFlag").text();
        if(deleteFlag == "1" || deleteFlag == 1){
            $("#deleteFlag").text("禁用");
        }else{
            $("#deleteFlag").text("启用");
        }
        //是否主页显示
        var isHomePage = $("#isHomePage").text();
        if(isHomePage == "1" || isHomePage == 1){
            $("#isHomePage").text("显示");
        }else{
            $("#isHomePage").text("不显示");
        }
        loadFileList();
    }

    function loadFileList(){
        var fileUrlsArr = new Array();
        var fileUrls = $("#imgUrl").val();
        if(fileUrls.length > 0){
            for(var i = 0; i < fileUrls.split(",").length; i++){
                var fileUrl =  fileUrls.split(",")[i];
                if("" != fileUrl && undefined != fileUrl){
                    var fileName = fileUrl.substr(fileUrl.lastIndexOf("/") + 1,fileUrl.length);
                }
                if(fileUrl.substr(fileUrl.length-4) == ".zip"){
                    $("#attachment").append("<li id='" + fileUrl + "' title='" + fileName + "'>" +
                        "<a target='_blank' href='" + fileUrl + "'>" +
                        "<img src='../../../static/images/zipPic.png' height='30px' width='30px' style='margin-right:20px;' />" +
                        "<div>" + fileName + "</div>" +
                        "</a>" +
                        "</li>");
                }else{
                    $("#attachment").append("<li id='" + fileUrl + "' title='" + fileName + "'>" +
                        "<a target='_blank' href='" + fileUrl + "'>" +
                        "<img src='" + fileUrl + "' height='30px' width='30px' style='margin-right:20px;' />" +
                        "<div>" + fileName + "</div>" +
                        "</a>" +
                        "</li>");
                }
            }
        }
    }
</script>
<form id="saveForm" templateUrl="advertise/get.do">
    <table style="margin: 10px auto;border: 1px solid darkgrey;padding: 10px">
        <tr>
            <td>
                <div class="div-label"><span class="nullTip">*</span>内容：</div>
            </td>
            <td colspan="3">
                <div class="div-item" style="width: 90%">${content.content}</div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="div-label"><span class="nullTip">*</span>金融代码：</div>
            </td>
            <td>
                <div class="div-item">${content.code.code}</div>
            </td>
            <td>
                <div class="div-label"><span class="nullTip">*</span>持续时间(天)：</div>
            </td>
            <td>
                <div class="div-item">${content.duration}</div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="div-label"><span class="nullTip">*</span>是否启用：</div>
            </td>
            <td>
                <div class="div-item" id="deleteFlag">${content.deleteFlag} </div>
            </td>
            <td>
                <div class="div-label"><span class="nullTip">*</span>是否主页显示：</div>
            </td>
            <td>
                <div class="div-item" id="isHomePage">${content.isHomePage} </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="div-label">备注：</div>
            </td>
            <td colspan="3">
                <div class="div-item" style="width: 90%">${content.remark} </div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="div-label">广告URL：</div>
            </td>
            <td colspan="3">
                <div class="div-item" style="width: 90%"><a href="${content.advertiseUrl}" target="_blank">${content.advertiseUrl}</a></div>
            </td>
        </tr>
        <tr>
            <td>
                <div class="div-label"><span class="nullTip">*</span>图片：</div>
            </td>
            <td>
                <input type="hidden" id="imgUrl" name="imgUrl" value="${content.imgUrl}"/>
            </td>
            <td colspan="2">
                <ul id="attachment" style="padding:5px"></ul>
            </td>
        </tr>
    </table>
</form>
<div class="form-buttons">
    <a id="btnBack" class="easyui-linkbutton c2" href="#" iconCls="icon-undo" onClick="parent.j_closeWin();">返回</a>
</div>